home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Conditional_JScript.asp < prev    next >
Encoding:
Text File  |  1998-05-29  |  1.8 KB  |  84 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3. <!*************************
  4. This sample is provided for educational purposes only. It is not intended to be 
  5. used in a production environment, has not been tested in a production environment, 
  6. and Microsoft will not provide technical support for it. 
  7. *************************>
  8.  
  9. <HTML>
  10.     <HEAD>
  11.         <TITLE>Conditional Operator Sample</TITLE>
  12.     </HEAD>
  13.  
  14.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  15.  
  16.         <!-- Display header. -->
  17.  
  18.         <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  19.         <B>Conditional Operator Sample</B></FONT><BR>
  20.       
  21.               
  22.         <HR SIZE="1" COLOR="#000000">
  23.  
  24.         <%
  25.             var dtmVar
  26.  
  27.             //Determine Date.
  28.             dtmVar = new Date();
  29.         %>
  30.         
  31.         
  32.         <!-- Display date. -->
  33.         <P>The date is: <%= dtmVar.getMonth()+1 %>/<%= dtmVar.getDate() %>/<%= dtmVar.getYear() %></P>  
  34.  
  35.         <%
  36.             //Switch statement to display a message based on the day of the month.
  37.             switch (dtmVar.getDate())
  38.             {
  39.               case 1:
  40.               case 2:
  41.               case 3:
  42.               case 4:
  43.               case 5:
  44.               case 6:
  45.               case 7:
  46.               case 8:
  47.               case 9:
  48.               case 10:
  49.                Response.Write("<P>It's the beginning of the month.</P>");
  50.                break;
  51.               case 11:
  52.               case 12:
  53.               case 13:
  54.               case 14:
  55.               case 15:
  56.               case 16:
  57.               case 17:
  58.               case 18:
  59.               case 19:
  60.               case 20:
  61.                Response.Write("<P>It's the middle of the month.</P>");
  62.                break;
  63.               default:
  64.                 Response.Write("<P>It's the end of the month.</P>");
  65.             }
  66.         %>
  67.  
  68.         <P>The time is: <%= dtmVar.getHours() %>:<%= dtmVar.getMinutes() %>:<%= dtmVar.getSeconds() %></P>
  69.  
  70.         <%
  71.             //Check for AM/PM, and output appropriate message.        
  72.             if (dtmVar.getHours() >= 12)
  73.             {
  74.                 Response.Write("<P>Good Evening</P>");
  75.             }
  76.             else
  77.             {
  78.                 Response.Write("<P>Good Morning</P>");
  79.             }
  80.         %>
  81.  
  82.     </BODY>
  83. </HTML>
  84.